<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

defined('IN_ADMIN') or die('Hacking Attempt!');

func::isLogin();
mysql::begin(0);

$sTable = "inventory";

if(isset($_POST['addInventoryButton'])){
    $aVals = array(
        'title' => isset($_POST['title']) ? func::cleanString($_POST['title']) : '',
        'price' => (isset($_POST['price']) && is_numeric(func::numberFormatInput($_POST['price']))) ? func::numberFormatInput($_POST['price']) : 0,
        'quantity' => (isset($_POST['quantity']) && is_numeric(func::numberFormatInput($_POST['quantity']))) ? func::numberFormatInput($_POST['quantity']) : 0,
        'date' => time()
    );
    
    $iIdInsertInventory = mysql::insertSql($sTable, $aVals);
    if($iIdInsertInventory)
        func::redirect(func::makeUrl('inventory', 'list'));
}
?>
